package com.zs4sdk.entity;


import com.common.library.entity.JSONResultEntity;
import com.common.library.util.Helper;

import org.json.JSONException;
import org.json.JSONObject;

/**
 *
 * function: QQ订单返回json类
 *
 * @ author: ke
 */
public class XzSignOrderResultEntity extends JSONResultEntity {

    public static final String COLUMN_ERRCODE = "error";
    public static final String COLUMN_STATUS = "status";
    public static final String COLUMN_DESC = "desc";
    public static final String COLUMN_DATA = "data";

    private String error = "";
    private String status = "";
    private String desc = "";
    private String data = "";

    /**
     * 构造方法
     */
    public XzSignOrderResultEntity(){

    }
    /**
     * 构造方法
     * @param json
     */
    public XzSignOrderResultEntity(JSONObject json){
        this.fromJSON(json);
    }
    /**
     * 构造方法
     * @param jsonStr
     */
    public XzSignOrderResultEntity(String jsonStr){
        try{
            this.fromJSON(new JSONObject(jsonStr));
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

    //#endregion 构造方法

    //#region Override方法
    @Override
    public JSONObject toJSON() {
        JSONObject result = super.toJSON();
        try {
            result.put(COLUMN_DESC, this.desc);
            result.put(COLUMN_ERRCODE, this.error);
            result.put(COLUMN_STATUS, this.status);
            result.put(COLUMN_DATA, this.data);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return result;
    }

    @Override
    public void fromJSON(JSONObject json) {
        super.fromJSON(json);
        if (Helper.isNotEmpty(json)) {
            try {
                this.desc = json.optString(COLUMN_DESC);
                this.error = json.optString(COLUMN_ERRCODE);
                this.status = json.optString(COLUMN_STATUS);
                this.data = json.optString(COLUMN_DATA);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    @Override
    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
}
